// JavaScript Document
/* PROJECT : AplayMap TAG
*	@require MyClass.js
*	@require jshashtable.js
*	@require OpenLayers.js
*	@autor: Mauricio Sanchez
*	@create: 24-07-2009
*	Clase con funciones para manipular los iconos y hacer preloads de las imagenes que se utilizan en el mapa.
*/

//.
MapIcons = new MyClass({
	CLASS_NAME: "MapIcons",

	/**
     * CONSTANT: Url's de las carpetas de imagenes
     * {String}
     */
	 URL_IMG_FIJOS: 'images/markers',
	 URL_IMG_MOVILES: 'images/markers',
	 URL_IMG_SELECCION: 'images/markers/sentido',
	 URL_IMG_SEGUIMIENTO: 'images/markers/sentido',
	 URL_IMG_SENTIDO: 'images/markers/sentido',
	 URL_IMG_HISTORICO: 'images/markers/historico',
	 URL_IMG_MISPUNTOS: 'images/markers/puntos',

	/**
     * Property: opciones de carga al inicializar la clase
     * {boolean}
     */
	 fijos: true, //carga iconos de los fijo
	 moviles: true, //carga iconos de los moviles y sentidos
	 historico: true, //carga iconos para historico
	 seleccion: true, //carga icono de movil seleccionado
	 seguimiento: true, //carga icono de movil en seguimiento
	 misPuntos: true, //carga iconos de mis puntos

	 /**
     * Property: urlBase
	 * 	 Url base del sitio donde se encuentran los archivos js de Aplay Map Tag
     * {String}
     */
	 urlBase: '',

	 /**
     * Property: movilIcons
	 * 	 Hash de objetos "OpenLayers.Icon" con las imagenes de todos los tipos de moviles.
     * {Hashtable}
     */
	 movilIcons: null,

	 /**
     * Property: sentidoIcons
	 * 	 Hash de objetos "OpenLayers.Icon" con los sentidos y la actividad o no(fondo rojo, verde o gris).
     * {Hashtable}
     */
	 sentidoIcons: null, //hash de objetos "" con los sentidos y la actividad o no(rojo o verde).

	 /**
     * Property: historicoIcons
	 * 	 Hash de objetos "OpenLayers.Icon" con los iconos para las markers de recorridos historicos.
     * {Hashtable}
     */
	 historicoIcons: null, //hash de objetos "" con los iconos para las markers de recorridos historicos.

	 /**
     * Property: seleccionadoIcon
	 * 	 Hash de objetos "OpenLayers.Icon" con los iconos para las markers de recorridos historicos.
     * {Hashtable}
     */
	 seleccionadoIcon: null, //icono que indica seleccion o no de un movil.
	 seguimientoIcon: null, //icono que indica si un movil esta en seguimiento o no.

	 /**
     * Property: misPuntosIcons
	 * 	 Hash de objetos "OpenLayers.Icon" con los iconos para las markers de mis puntos.
     * {Hashtable}
     */
	 misPuntosIcons: null, //hash de objetos "" con los iconos para las markers de mis puntos.

	/**
     * Method: init
     */
	init: function(opciones){
		for (var key in opciones) {
			this[key] = opciones[key];
		}
		this.URL_IMG_FIJOS = this.urlBase + this.URL_IMG_FIJOS;
		this.URL_IMG_MOVILES = this.urlBase + this.URL_IMG_MOVILES;
		this.URL_IMG_SENTIDO = this.urlBase + this.URL_IMG_SENTIDO;
		this.URL_IMG_HISTORICO = this.urlBase + this.URL_IMG_HISTORICO;
		if (this.fijos){
			this.loadFijosIcons();
		}
		//i
		if (this.moviles){
			this.loadMovilIcons();
			this.loadSentidoIcons();
		}
		if (this.historico){
			this.loadHistoricoIcons();
		}
	 	if (this.seleccion){
			this.loadSeleccionadoIcon();
		}
	 	if (this.seguimiento){
			this.loadSeguimientoIcon();
		}
		//if (this.misPuntos){
		this.loadMisPuntosIcons();
		//}
	},

	/**
     * Method: createIconFromUrl
     * 	 Crea un objeto "OpenLayers.Icon" desde la url de una imagen (preferentemente PNG)
     * Parameters:
     *   url - {String}
	 *	 size - {OpenLayers.Size}
	 *	 offset - {OpenLayers.Size}
	 * Return
	 *   {OpenLayers.Icon}
     */
	createIconFromUrl: function(url, size, offset){
		if (size==null)
	   		size = new OpenLayers.Size(40,40); //default size
		if (offset==null){
			var calculateOffset = function(size) {
    	                    return new OpenLayers.Pixel(-(size.w/2), -(size.h/2));
        			        };
			return (new OpenLayers.Icon(url, size, null, calculateOffset));
			}
		return (new OpenLayers.Icon(url, size, offset));
	},

	/**
	 * Method: loadFijosIcons
	 * 	 Crea y carga la hashtable "fijosIcons" con los iconos definidos por defecto.
	 */
	loadFijosIcons: function() {
		this.fijosIcons = new Hashtable();
		this.fijosIcons.put('1',this.createIconFromUrl(this.URL_IMG_FIJOS+'/ico_casa.png'));
	},
	/**
     * Method: loadMovilIcons
     * 	 Crea y carga la hashtable "movilIcons" con los iconos definidos por defecto.
     */
	loadMovilIcons: function() {
  		this.movilIcons = new Hashtable();
		this.movilIcons.put('1',this.createIconFromUrl(this.URL_IMG_MOVILES+'/camion.png'));
  		this.movilIcons.put('1_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/camionOUT.png'));
  		this.movilIcons.put('2',this.createIconFromUrl(this.URL_IMG_MOVILES+'/camioneta.png'));
  		this.movilIcons.put('2_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/camionetaOUT.png'));
		this.movilIcons.put('3',this.createIconFromUrl(this.URL_IMG_MOVILES+'/auto.png'));
  		this.movilIcons.put('3_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/autoOUT.png'));
		this.movilIcons.put('4',this.createIconFromUrl(this.URL_IMG_MOVILES+'/remolque.png'));
  		this.movilIcons.put('4_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/remolqueOUT.png'));
		this.movilIcons.put('5',this.createIconFromUrl(this.URL_IMG_MOVILES+'/telefono.png'));
  		this.movilIcons.put('5_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/telefonoOUT.png'));
		this.movilIcons.put('6',this.createIconFromUrl(this.URL_IMG_MOVILES+'/moto.png'));
  		this.movilIcons.put('6_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/motoOUT.png'));
		this.movilIcons.put('7',this.createIconFromUrl(this.URL_IMG_MOVILES+'/tractor.png'));
  		this.movilIcons.put('7_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/tractorOUT.png'));

  		this.movilIcons.put('25',this.createIconFromUrl(this.URL_IMG_MOVILES+'/cuadrado25.png',new OpenLayers.Size(25,25)));
  		this.movilIcons.put('33',this.createIconFromUrl(this.URL_IMG_MOVILES+'/cuadrado33.png',new OpenLayers.Size(33,33)));
  		this.movilIcons.put('40',this.createIconFromUrl(this.URL_IMG_MOVILES+'/cuadrado40.png',new OpenLayers.Size(40,40)));
  		this.movilIcons.put('65',this.createIconFromUrl(this.URL_IMG_MOVILES+'/cuadrado65.png',new OpenLayers.Size(65,65)));

  		this.movilIcons.put('TAXILIBRE',this.createIconFromUrl(this.URL_IMG_MOVILES+'/taxiLibre.png'));
  		this.movilIcons.put('TAXILIBRE_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/taxiLibreOUT.png'));
  		this.movilIcons.put('TAXIOCUP',this.createIconFromUrl(this.URL_IMG_MOVILES+'/taxiOcup.png'));
  		this.movilIcons.put('TAXIOCUP_OUT',this.createIconFromUrl(this.URL_IMG_MOVILES+'/taxiOcupOUT.png'));
  		this.movilIcons.put('PREPANICO25',this.createIconFromUrl(this.URL_IMG_MOVILES+'/prepanico25.png',new OpenLayers.Size(35,35),new OpenLayers.Pixel(-17,-21)));
  		this.movilIcons.put('PREPANICO33',this.createIconFromUrl(this.URL_IMG_MOVILES+'/prepanico33.png',new OpenLayers.Size(45,45),new OpenLayers.Pixel(-22,-30)));
  		this.movilIcons.put('PREPANICO40',this.createIconFromUrl(this.URL_IMG_MOVILES+'/prepanico40.png',new OpenLayers.Size(50,50),new OpenLayers.Pixel(-25,-37)));
  		this.movilIcons.put('PREPANICO65',this.createIconFromUrl(this.URL_IMG_MOVILES+'/prepanico65.png',new OpenLayers.Size(75,75),new OpenLayers.Pixel(-37,-56)));
	},

	/**
     * Method: loadSentidoIcons
     * 	 Crea y carga la hashtable "sentidoIcons" con los iconos definidos por defecto.
     */
	loadSentidoIcons: function() {
  		this.sentidoIcons = new Hashtable();
		this.sentidoIcons.put('n_active',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/nActive.png'));
  		this.sentidoIcons.put('ne_active',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/neActive.png'));
		this.sentidoIcons.put('e_active',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/eActive.png'));
		this.sentidoIcons.put('se_active',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/seActive.png'));
  		this.sentidoIcons.put('s_active',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/sActive.png'));
  		this.sentidoIcons.put('so_active',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/soActive.png'));
		this.sentidoIcons.put('o_active',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/oActive.png'));
		this.sentidoIcons.put('no_active',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/noActive.png'));
		this.sentidoIcons.put('n_inactive',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/nInactive.png'));
		this.sentidoIcons.put('ne_inactive',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/neInactive.png'));
		this.sentidoIcons.put('e_inactive',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/eInactive.png'));
		this.sentidoIcons.put('se_inactive',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/seInactive.png'));
		this.sentidoIcons.put('s_inactive',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/sInactive.png'));
		this.sentidoIcons.put('so_inactive',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/soInactive.png'));
		this.sentidoIcons.put('o_inactive',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/oInactive.png'));
		this.sentidoIcons.put('no_inactive',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/noInactive.png'));
		this.sentidoIcons.put('n_out',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/nOut.png'));
		this.sentidoIcons.put('ne_out',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/neOut.png'));
		this.sentidoIcons.put('e_out',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/eOut.png'));
		this.sentidoIcons.put('se_out',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/seOut.png'));
		this.sentidoIcons.put('s_out',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/sOut.png'));
		this.sentidoIcons.put('so_out',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/soOut.png'));
		this.sentidoIcons.put('o_out',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/oOut.png'));
		this.sentidoIcons.put('no_out',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/noOut.png'));
		
		/////////////////////////imagenes para tama�o de figura MUY GRANDE////////////////////////
		this.sentidoIcons.put('n_active_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoN.png', new OpenLayers.Size(90,90) ));
		this.sentidoIcons.put('s_active_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoS.png', new OpenLayers.Size(90,90) ));
		this.sentidoIcons.put('e_active_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoE.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('o_active_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoO.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('ne_active_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoNE.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('no_active_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoNO.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('se_active_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoSE.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('so_active_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoSO.png', new OpenLayers.Size(90,90)));
		
		this.sentidoIcons.put('n_inactive_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoNInactive.png', new OpenLayers.Size(90,90) ));
		this.sentidoIcons.put('s_inactive_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoSInactive.png', new OpenLayers.Size(90,90) ));
		this.sentidoIcons.put('e_inactive_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoEInactive.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('o_inactive_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoOInactive.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('ne_inactive_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoNEInactive.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('no_inactive_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoNOInactive.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('se_inactive_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoSEInactive.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('so_inactive_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoSOInactive.png', new OpenLayers.Size(90,90)));
		
		this.sentidoIcons.put('n_out_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoNOut.png', new OpenLayers.Size(90,90) ));
		this.sentidoIcons.put('s_out_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoSOut.png', new OpenLayers.Size(90,90) ));
		this.sentidoIcons.put('e_out_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoEOut.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('o_out_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoOOut.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('ne_out_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoNEOut.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('no_out_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoNOOut.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('se_out_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoSEOut.png', new OpenLayers.Size(90,90)));
		this.sentidoIcons.put('so_out_simpleview65',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size65/cuadrado65SentidoSOOut.png', new OpenLayers.Size(90,90)));
		//////////////////////////////////////////////////////////////////////////////////////
		/////////////////////////imagenes para tama�o de figura GRANDE////////////////////////
		this.sentidoIcons.put('n_active_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoN.png', new OpenLayers.Size(54,54) ));
		this.sentidoIcons.put('s_active_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoS.png', new OpenLayers.Size(54,54) ));
		this.sentidoIcons.put('e_active_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoE.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('o_active_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoO.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('ne_active_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoNE.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('no_active_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoNO.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('se_active_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoSE.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('so_active_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoSO.png', new OpenLayers.Size(54,54)));
		
		this.sentidoIcons.put('n_inactive_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoNInactive.png', new OpenLayers.Size(54,54) ));
		this.sentidoIcons.put('s_inactive_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoSInactive.png', new OpenLayers.Size(54,54) ));
		this.sentidoIcons.put('e_inactive_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoEInactive.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('o_inactive_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoOInactive.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('ne_inactive_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoNEInactive.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('no_inactive_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoNOInactive.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('se_inactive_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoSEInactive.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('so_inactive_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoSOInactive.png', new OpenLayers.Size(54,54)));
		
		this.sentidoIcons.put('n_out_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoNOut.png', new OpenLayers.Size(54,54) ));
		this.sentidoIcons.put('s_out_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoSOut.png', new OpenLayers.Size(54,54) ));
		this.sentidoIcons.put('e_out_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoEOut.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('o_out_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoOOut.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('ne_out_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoNEOut.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('no_out_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoNOOut.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('se_out_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoSEOut.png', new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('so_out_simpleview40',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size40/cuadrado40SentidoSOOut.png', new OpenLayers.Size(54,54)));
		//////////////////////////////////////////////////////////////////////////////////////
		
		
		/////////////////////////imagenes para tama�o de figura MEDIANO///////////////////////
		this.sentidoIcons.put('n_active_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoN.png'));
		this.sentidoIcons.put('s_active_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoS.png'));
		this.sentidoIcons.put('e_active_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoE.png'));
		this.sentidoIcons.put('o_active_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoO.png'));
		this.sentidoIcons.put('ne_active_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoNE.png'));
		this.sentidoIcons.put('no_active_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoNO.png'));
		this.sentidoIcons.put('se_active_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoSE.png'));
		this.sentidoIcons.put('so_active_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoSO.png'));

		this.sentidoIcons.put('n_inactive_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoNInactive.png'));
		this.sentidoIcons.put('s_inactive_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoSInactive.png'));
		this.sentidoIcons.put('e_inactive_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoEInactive.png'));
		this.sentidoIcons.put('o_inactive_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoOInactive.png'));
		this.sentidoIcons.put('ne_inactive_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoNEInactive.png'));
		this.sentidoIcons.put('no_inactive_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoNOInactive.png'));
		this.sentidoIcons.put('se_inactive_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoSEInactive.png'));
		this.sentidoIcons.put('so_inactive_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoSOInactive.png'));
		
		this.sentidoIcons.put('n_out_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoNOut.png'));
		this.sentidoIcons.put('s_out_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoSOut.png'));
		this.sentidoIcons.put('e_out_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoEOut.png'));
		this.sentidoIcons.put('o_out_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoOOut.png'));
		this.sentidoIcons.put('ne_out_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoNEOut.png'));
		this.sentidoIcons.put('no_out_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoNOOut.png'));
		this.sentidoIcons.put('se_out_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoSEOut.png'));
		this.sentidoIcons.put('so_out_simpleview33',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size33/cuadrado33SentidoSOOut.png'));
		//////////////////////////////////////////////////////////////////////////////////////
		
		
		/////////////////////////imagenes para tama�o de figura CHICO/////////////////////////
		this.sentidoIcons.put('n_active_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoN.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('s_active_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoS.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('e_active_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoE.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('o_active_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoO.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('ne_active_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoNE.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('no_active_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoNO.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('se_active_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoSE.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('so_active_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoSO.png', new OpenLayers.Size(30,30)));

		this.sentidoIcons.put('n_inactive_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoNInactive.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('s_inactive_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoSInactive.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('e_inactive_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoEInactive.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('o_inactive_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoOInactive.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('ne_inactive_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoNEInactive.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('no_inactive_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoNOInactive.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('se_inactive_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoSEInactive.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('so_inactive_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoSOInactive.png', new OpenLayers.Size(30,30)));
		
		this.sentidoIcons.put('n_out_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoNOut.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('s_out_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoSOut.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('e_out_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoEOut.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('o_out_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoOOut.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('ne_out_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoNEOut.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('no_out_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoNOOut.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('se_out_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoSEOut.png', new OpenLayers.Size(30,30)));
		this.sentidoIcons.put('so_out_simpleview25',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/size25/cuadrado25SentidoSOOut.png', new OpenLayers.Size(30,30)));
		//////////////////////////////////////////////////////////////////////////////////////
		this.sentidoIcons.put('circulo1',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/circulo1.png',new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('circulo2',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/circulo2.png',new OpenLayers.Size(54,54)));
		this.sentidoIcons.put('circulo3',this.createIconFromUrl(this.URL_IMG_SENTIDO+'/circulo3.png',new OpenLayers.Size(54,54)));
	},

	/**
     * Method: loadHistoricoIcons
     * 	 Crea y carga la hashtable "historicoIcons" con los iconos definidos por defecto.
     */
	loadHistoricoIcons: function() {
		this.historicoIcons = new Hashtable();
		this.historicoIcons.put('inicio',this.createIconFromUrl(this.URL_IMG_HISTORICO+'/inicio.png', new OpenLayers.Size(26,30), new OpenLayers.Pixel(-13, -29)));
	    this.historicoIcons.put('fin',this.createIconFromUrl(this.URL_IMG_HISTORICO+'/fin.png', new OpenLayers.Size(26,30), new OpenLayers.Pixel(-13, -29)));
	    this.historicoIcons.put('evento',this.createIconFromUrl(this.URL_IMG_HISTORICO+'/evento.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-2, -24)));
		this.historicoIcons.put('exceso',this.createIconFromUrl(this.URL_IMG_HISTORICO+'/exceso.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-2, -24)));
	    this.historicoIcons.put('parada',this.createIconFromUrl(this.URL_IMG_HISTORICO+'/parada.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-2, -24)));
	},

	/**
     * Method: loadSeleccionadoIcon
     * 	 Crea y carga el OpenLayers.Icon "seleccionadoIcon" con el icono definido por defecto.
     */
	loadSeleccionadoIcon: function() {
		this.seleccionadoIcon = this.createIconFromUrl(this.URL_IMG_SELECCION+'/Seleccionado.png');
	},

	/**
     * Method: loadSeguimientoIcon
     * 	 Crea y carga el OpenLayers.Icon "lseguimientoIcon" con el icono definido por defecto.
     */
	loadSeguimientoIcon: function() {
		this.seguimientoIcon = this.createIconFromUrl(this.URL_IMG_SEGUIMIENTO+'/Seguimiento.png');
	},

	/**
     * Method: loadMisPuntosIcons
     * 	 Crea y carga la hashtable "misPuntosIcons" con los iconos definidos por defecto.
     */
	loadMisPuntosIcons: function() {
		this.misPuntosIcons = new Hashtable();
		this.misPuntosIcons.put('0',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/newPoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('1',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/casaPoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('2',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/oficinaPoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('3',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/estacionPoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('4',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/hotelPoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('5',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/cafePoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('6',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/cocheraPoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('7',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/peajePoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('8',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/terminalPoint.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		
		this.misPuntosIcons.put('9',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/banco.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('10',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/bomberos.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('11',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/escuela2.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('12',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/hospital.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('13',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/municipio.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('14',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/policia2.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('15',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/radial.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('16',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/restaurant.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('17',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/satelite24px.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
		this.misPuntosIcons.put('18',this.createIconFromUrl(this.URL_IMG_MISPUNTOS+'/tren.png', new OpenLayers.Size(24,24), new OpenLayers.Pixel(-12, -12)));
	},

	/**
     * Method: getMisPuntosLabels
     * 	 Retorna un array con los labels de todos los iconos de MisPuntos (posicion = value). Se utiliza por ejemplo para crear un selector.
     */
	getMisPuntosLabels: function() {
		var retorno = new Array();
		retorno[0]='Pinche';
		retorno[1]='Casa';
		retorno[2]='Oficina';
		retorno[3]='Estacion de servicio';
		retorno[4]='Hotel';
		retorno[5]='Cafeteria';
		retorno[6]='Estacionamiento/Cochera';
		retorno[7]='Estacion de peaje';
		retorno[8]='Terminal de omnibus';
		retorno[9]='Banco';
		retorno[10]='Bomberos';
		retorno[11]='Escuela';
		retorno[12]='Hospital';
		retorno[13]='Municipio';
		retorno[14]='Policia';
		retorno[15]='Antena radial';
		retorno[16]='Restaurant';
		retorno[17]='Antena satelital';
		retorno[18]='Estacion de tren';
		return retorno;
	},

	/**
     * Method: getMovilIcon
     * 	 Retorna el icono de un movil dada una KEY o bien un icono por default si no la encontro.
	 * Parameters:
     *   key - {String}
	 *   {OpenLayers.Icon}
     */
	getMovilIcon: function(key) {
		key = key.toString().toUpperCase();
		var icono = this.movilIcons.get(key);
		if (icono==null){
			if (key.toLowerCase().search('_OUT')!=-1)
				icono = this.movilIcons.get("3_OUT"); //ICONO DEFAULT OUT
			else
				icono = this.movilIcons.get("3"); //ICONO DEFAULT
		}
		return icono.clone();
	},

	/**
     * Method: getSentidoIcon
     * 	 Retorna el icono de sentido de un movil dada una KEY o bien un icono por default si no la encontro.
	 * Parameters:
     *   key - {String}
	 *   {OpenLayers.Icon}
     */
	getSentidoIcon: function(key) {
		key = key.toString().toLowerCase();
		var icono = this.sentidoIcons.get(key);
		if (icono==null)
			icono = this.sentidoIcons.get("n_active"); //ICONO DEFAULT
		return icono.clone();
	},

	/**
     * Method: getHistoricoIcon
     * 	 Retorna un icono de historico dada una KEY o bien un icono por default si no la encontro.
	 * Parameters:
     *   key - {String}
	 *   {OpenLayers.Icon}
     */
	getHistoricoIcon: function(key) {
		key = key.toString().toLowerCase();
		var icono = this.historicoIcons.get(key);
		if (icono==null)
			icono = this.historicoIcons.get("evento"); //ICONO DEFAULT
		return icono.clone();
	},

	/**
     * Method: getSeleccionadoIcon
     * 	 Retorna un icono de seleccion de movil.
	 * Parameters:
     *   key - {String}
	 *   {OpenLayers.Icon}
     */
	getSeleccionadoIcon: function() {
		return this.seleccionadoIcon.clone();
	},

	/**
     * Method: getSeguimientoIcon
     * 	 Retorna un icono de seguimiento de movil.
	 * Parameters:
     *   key - {String}
	 *   {OpenLayers.Icon}
     */
	getSeguimientoIcon: function() {
		return this.seguimientoIcon.clone();
	},

	/**
     * Method: getMisPuntosIcon
     * 	 Retorna un icono de Mis Puntos dada una KEY o bien un icono por default si no la encontro.
	 * Parameters:
     *   key - {String}
	 *   {OpenLayers.Icon}
     */
	getMisPuntosIcon: function(key) {
		key = key.toString().toLowerCase();
		var icono = this.misPuntosIcons.get(key);
		if (icono==null)
			icono = this.misPuntosIcons.get("0"); //ICONO DEFAULT
		return icono.clone();
	},
	/**
     * Method: getFijoIcon
     * 	 Retorna el icono de un fijo dada una KEY o bien un icono por default si no la encontro.
	 * Parameters:
     *   key - {String}
	 *   {OpenLayers.Icon}
     */
	getFijoIcon: function(key) {
		key = key.toString().toUpperCase();
		var icono = this.fijosIcons.get(key);
		if (icono==null){
			if (key.toLowerCase().search('_OUT')!=-1)
				icono = this.fijosIcons.get("1"); //ICONO DEFAULT OUT
			else
				icono = this.fijosIcons.get("1"); //ICONO DEFAULT
		}
		return icono.clone();
	}


});

//mapIcons = new MapIcons();